package com.google.code.cakedroid.handler;

import com.google.code.cakedroid.base.ContextResources;
import com.google.code.cakedroid.context.DialogHelper;

import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;


/**
 *
 *@author androidyue
 *Last Modified:2011-12-9    ����11:17:15
 */
public class DialogHandler extends ContextResources {
	private DialogHelper dialogHelper;
	
	public DialogHandler(Context context){
		super(context);
		this.dialogHelper=new DialogHelper(this.context);
	}
	

    
	/*
	 * get about dialog
	 */
	public  Dialog getAboutDialog(){
	/*String message=this.res.getString(R.string.app_about);
	message=message+this.res.getString(R.string.app_version)+AppData.appVersion;
	message+=this.res.getString(R.string.app_author)+AuthorConstants.AUTHOR_NAME;
	return this.dialogHelper.getSimpleDialog(R.string.dialog_about_title,message, R.string.dialog_ok);
	 */
		return null;
	}

	/*
	 * technical support
	 */
	public  Dialog  getSupportDialog(){
		/*TextView textView=new TextView(this.context);
		textView.setAutoLinkMask(Linkify.ALL);
		String message=this.res.getString(R.string.support)+AuthorConstants.AUTHOR_EMAIL;
		textView.setText(message);
		return this.dialogHelper.getSimpleCustomizedDialog(R.string.dialog_support_title, textView,R.string.dialog_suppot_ok);*/
		return null;
	}
	
	/*
	 * get result dialog 
	 */
	public  Dialog getResultDialog(boolean result){
		/*Dialog dialog;
		if(result){
			String message=this.res.getString(R.string.dialog_result_ok_message);
			dialog=this.dialogHelper.getSimpleDialog(R.string.dialog_result_title, message, R.string.dialog_ok);
		}else{
			String message=this.res.getString(R.string.dialog_result_error_message);
			dialog=this.dialogHelper.getSimpleDialog(R.string.dialog_result_title,message,R.string.dialog_ok);
		}
		return dialog;*/
		return null;
	}
	
	/*
	 * get unavailable dialog
	 */
	public  Dialog getUnavailableDialog(){
		/*String message=this.res.getString(R.string.dialog_unavailable_message);
		Dialog dialog=this.dialogHelper.getComplexDialog(R.string.dialog_unavailable_title, message,R.string.dialog_uninstall,
				R.string.dialog_i_know, new UninstallDialogButtonOnClickListener());
		return dialog;*/
		return null;
	}
	
	
	/*
	 * get confirm dialog
	 */
	public  Dialog getConfirmDialog(String providerName,DialogInterface.OnClickListener dialogListener){
		/*String message=this.res.getString(R.string.dialog_confirm_message_start)+providerName
				+this.res.getString(R.string.dialog_confirm_message_end);
		
		Dialog dialog=this.dialogHelper.getComplexDialog(R.string.dialog_confirm_title, message,
				R.string.dialog_confirm_positive, R.string.dialog_confirm_negative,
				dialogListener);
		return dialog;*/
		return null;
	}
	
	public Dialog getNoNeedUpgrade(){
		/*String message=this.res.getString(R.string.dialog_check_no_upgrade);
		return this.dialogHelper.getSimpleDialog(R.string.dialog_check_title, message, R.string.dialog_ok);*/
		return null;
	}
	/*
	 * get upgrade dialog
	 */
	public Dialog getUpgradeDialog(String version,String feature){
		/*String message=this.res.getString(R.string.dialog_upgrade_message_start)
				+this.res.getString(R.string.dialog_upgrade_message_version)+version
				+this.res.getString(R.string.dialog_upgrade_message_info)+feature
				+this.res.getString(R.string.dialog_upgrade_message_end);
		DialogInterface.OnClickListener dialogListener=new UpgradeDialogButtonOnClickListener();
		Dialog dialog=this.dialogHelper.getComplexDialog(R.string.dialog_check_title, message,
				R.string.dialog_check_positive,R.string.dialog_check_negative, dialogListener);
		return dialog;*/
		return null;
	}
	
	
	public Dialog getExitConfirmDialog(){
		//Dialog dialog=this.dialogHelper.getComplexDialog(titleId, message, positiveTextId, negativeTextId, dialogListener);
		return null;
	}
	
	 class UninstallDialogButtonOnClickListener implements DialogInterface.OnClickListener{

			@Override
			public void onClick(DialogInterface dialog, int which) {
				if(DialogInterface.BUTTON_POSITIVE==which){
					//new APKHandler(DialogHandler.this.context).uninstallAPK();
				}else{
				}
			}
	    }
	 
	 class UpgradeDialogButtonOnClickListener implements DialogInterface.OnClickListener{
			@Override
			public void onClick(DialogInterface dialog, int which) {
				if(DialogInterface.BUTTON_POSITIVE==which){
					//new UpgradeHandler(context).startUpgradeService();
				}
			}
	 }
	 
	 
}
